package com.awb.rabbitmqdemo.workqueues;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class WorkProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(){

        for (int i = 0; i < 5; i++) {
            String message = "一个对接多个消费者模式发送"+i;
            rabbitTemplate.convertAndSend("work_queue",message);
        }
    }
}
